package pers.qianyu.month_202101.date_20210124;

/**
 * 162. 寻找峰值
 * https://leetcode-cn.com/problems/find-peak-element/
 *
 * @author mizzle rain
 * @date 2021-01-24 11:30
 */
public class FindPeakElement {
    public int findPeakElement(int[] nums) {
        int left = 0, right = nums.length - 1;
        while (left < right) {
            int mid = left + right >> 1;
            if (nums[mid] > nums[mid + 1]) right = mid;
            else left = mid + 1;
        }
        return left;
    }
}
